﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- DW6 -->
<head>
<!-- Copyright 2005 Macromedia, Inc. All rights reserved. -->
<%@ page contentType="text/html; charset=utf-8"  language="java" import="java.util.*,java.text.*" pageEncoding="UTF-8" isELIgnored="false"%> 
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>  
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>后台管理</title>
<script language="javascript" type="text/javascript" src="<%=request.getContextPath()%>/admin/DatePicker/WdatePicker.js"></script>
<link href="<%=request.getContextPath()%>/js/css/ui-lightness/jquery-ui-1.8.18.custom.css" rel="stylesheet" type="text/css" />	
<script src="<%=request.getContextPath()%>/js/jquery.min.js" type="text/javascript"></script>
<script src="<%=request.getContextPath()%>/js/jquery-ui-1.8.18.custom.min.js" type="text/javascript"></script>
</head>
<body>
<%SimpleDateFormat formatDate=new SimpleDateFormat("yyyy-MM-dd");
  String today=formatDate.format(new Date());
%>
<form name="comment" action="<%=request.getContextPath()%>/admin/querycomment.do" method="post">
<table>
 <tr>
 <td>评论人员:</td><td><input type="text" name=orderno value="${param.orderno}"/></td>
 <td>开始时间:</td><td><input class="Wdate" name="beginDate" type="text" onclick="WdatePicker()"
 <c:if test="${empty param.beginDate}">
   value="<%=today%>"
 </c:if>
 <c:if test="${not empty param.beginDate}">
   value="${param.beginDate}"
 </c:if>
  readonly/></td>
 <td>结束时间:</td><td><input class="Wdate" name="endDate" type="text" onclick="WdatePicker()"  
  <c:if test="${empty param.endDate}">
   value="<%=today%>"
 </c:if>
 <c:if test="${not empty param.endDate}">
   value="${param.endDate}"
 </c:if>
  readonly/></td>
 <td>状态:</td>
 <td><select name="status">
 <option value="1" <c:if test="${param.status=='1'}" >selected</c:if> >正常</option>
 <option value="0" <c:if test="${param.status=='0'}" >selected</c:if> >屏蔽</option>
 </select>
 </td>
 <td><input type="submit" value="查询" /></td>
 </tr>
</table>
<table width="%100">
<td width="50px">ID</td>
<td width="50px">发表人</td>
<td width="300px">内容</td>
<td width="300px">回复内容</td>
<td width="50px">状态</td>
<td width="100px" colspan="2">操作</td>
 <c:forEach items="${comments}" var="comment">
<tr>
<td>${comment.id}</td>
<td>${comment.userId}</td>
<td>${comment.content}</td>
<td>${comment.recontent}</td>
<td>${comment.status==1?'正常':'屏蔽'}</td>
<td><a href="javascript:recomment('${comment.id}')" >回复</a></td>
<td><a href="javascript:closecomment('${comment.id}')">屏蔽</a></td>
<td><a href="javascript:opencomment('${comment.id}')">打开</a></td>

</tr>
</c:forEach>
</table>
</form>
<form name="update" action="<%=request.getContextPath()%>/admin/querycomment.do" method="post">
</form>
<div id="UserComment" title="回复评论">

 <div style="margin-bottom:10px">
 <textarea id="comment" name="comment" style="width:300px;height:100px" onpropertychange="limitChars('comment', 34,'comment_info')"></textarea>
 </div>
 <div >
   <span style="margin-right:50px;height:50px"><input style="height:30px;width:60px;margin-right:10px" type="button" value="回  复" onclick="savecomment();"/>
   <input style="height:30px;width:60px" type="button" value="取  消" onclick="closecomment();"/>
   </span>
   <span >您还可以输入<span id="comment_info" style="font-size:16px">34</span>个字</span>
  
 </div>
 </div>
</body>
</html>
 <script>
 var  currnetid='';
 function recomment(id)
 {
  currnetid=id;
  $('#UserComment').dialog('open');
 }
 
 function closecomment(id)
 {
  document.comment.action='<%=request.getContextPath()%>/admin/closecomment.do?method=closecomment&id='+id;
  document.comment.submit();
 }
 
 function opencomment(id)
 {
  document.comment.action='<%=request.getContextPath()%>/admin/opencomment.do?method=opencomment&id='+id;
  document.comment.submit();
 }
 
 function savecomment()
{
   var textvalue=$('#comment').val();
  if($.trim(textvalue)=='')
  {
    alert('评论回复内容不能为空!');
    return false;
  }
  var url='<%=request.getContextPath()%>/admin/recomment.do?method=recomment';
  if(currnetid!='')
  {
    url=url+'&id='+currnetid;
  }
	$.get(url,{ recontent: encodeURI($('#comment').val())}, function(result){
	  $('#UserComment').dialog('close');
	  document.comment.submit();
	});
 $('#comment').val("");
}

 //初始化数据
$(function(){
   $("#UserComment").dialog({autoOpen:false,width: 400,height:300,modal:false});
}) ;
 </script>
